package com.taoyige.bean;

import java.io.IOException;
import java.io.InputStream;
import java.util.Date;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import com.taoyige.AppException;
import com.taoyige.common.JacksonJsonUtil;

/**
 * 用户实体类
 * @author peter
 * @version 1.0
 * @created 2014-11-13
 */
public class User extends Entity{
	
	public final static String USER_ID = "id";
	public final static String USER_PID = "pid";
	public final static String USER_P_USER_ID = "pUserID";
	public final static String USER_P_USER_NAME = "pUserName";
	public final static String USER_NAME = "userName";
	public final static String USER_THUMB_URL = "thumbUrl";
	public final static String USER_ADDR_ID = "addressID";
	public final static String USER_TIMESTAMP = "timestamp";
	

	private Integer pid;
	private String pUserID;
	private String pUserName;
	private String userName;
	private String thumbUrl;
	private Long addressID;
	private Date timestamp;
	
	
	public Integer getPid() {
		return pid;
	}

	public void setPid(Integer pid) {
		this.pid = pid;
	}

	public String getpUserID() {
		return pUserID;
	}

	public void setpUserID(String pUserID) {
		this.pUserID = pUserID;
	}

	public String getpUserName() {
		return pUserName;
	}

	public void setpUserName(String pUserName) {
		this.pUserName = pUserName;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getThumbUrl() {
		return thumbUrl;
	}

	public void setThumbUrl(String thumbUrl) {
		this.thumbUrl = thumbUrl;
	}

	public Long getAddressID() {
		return addressID;
	}

	public void setAddressID(Long addressID) {
		this.addressID = addressID;
	}

	public Date getTimestamp() {
		return timestamp;
	}

	public void setTimestamp(Date timestamp) {
		this.timestamp = timestamp;
	}

	public static User  parse(InputStream ins) throws Exception {
		User user = (User) JacksonJsonUtil.jsonToBean(ins, User.class);
		return user;
	}
	
	public String toString() {
		return ToStringBuilder.reflectionToString(this,
				ToStringStyle.SHORT_PREFIX_STYLE);
	}
	
}
